package com.xxja.order.auth.user.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Pattern;
import java.util.Date;

@Data
@TableName("tb_user")
@ToString
public class User {
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    @Length(min = 4, max = 30, message = "用户名只能在4~30位之间")
    private String name;
    @Length(min = 4, max = 30, message = "密码只能在4~30位之间")
    private String password;
    @Pattern(regexp = "^1[35678]\\d{9}$", message = "手机号格式不正确")
    private String phone;
    private Date createtime;
    private Date updatetime;
    @TableLogic
    private int dr;
    public User(Long id, String name) {
        this.id = id;
        this.name = name;
    }
}
